package com.tencent.iov.cowin.befsale.clue.value.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.stream.Stream;

/**
 * @Describe: 跟进内容类型
 * @author: whp
 * @created: 2021-12-01 18:22:10
 * @version: 1.0
 */
@Getter
@AllArgsConstructor
public enum ClueStatsEnum {
    //线索状态（ 0跟进中 10已到店，15已下订，20已交车，25已实销，30战败审核 35已战败
    VALIDATION(-1,"验证"),
    FOLLOW_UP(0,"跟进中"),
    CHECKIN(10,"已到店"),
    ORDER(15,"已下订"),
    DELIVERY(20,"已交车"),
    CONSUMED(25,"已实销"),
    FAIL_APPROVE(30,"战败审核"),
    IS_FAIL(35,"已战败"),
    ;

    Integer code;
    String name;


    /**
     * 跟进type获
     * @param code
     * @return
     */
    public static String getDictionaries(Integer code){
        for (ClueStatsEnum cs : ClueStatsEnum.values()) {
            if(cs.getCode().equals(code)){
                return cs.getName();
            }
        }
        return null;
    }


    public static ClueStatsEnum getClueStatusByCode(Integer code) {
        return Stream.of(ClueStatsEnum.values())
                .filter(statsEnum -> statsEnum.code.equals(code)).findAny().orElse(null);
    }
}
